package timestamp;
import java.util.*;
import java.sql.Timestamp;



public class Dates {
  
  static boolean isLeapYear(int yyyy)
  {
    GregorianCalendar myDate = new GregorianCalendar(yyyy,1,29);
    if(myDate.get(Calendar.MONTH) == 1)
      return true;
    else
      return false;
  }
  
 public static void main(String[] args) {
     
      
      System.out.println("\n");
      //GregorianCalendar myDate = new GregorianCalendar(2007,2,30); // should be Independence Day
      GregorianCalendar myDate = new GregorianCalendar(); // should be Independence Day
      

      System.out.println("Lets Print myDates values");
      System.out.println("YEAR: " + myDate.get(Calendar.YEAR));
      System.out.println("MONTH: " + myDate.get(Calendar.MONTH));
      System.out.println("WEEK_OF_YEAR: " + myDate.get(Calendar.WEEK_OF_YEAR));
      System.out.println("WEEK_OF_MONTH: " + myDate.get(Calendar.WEEK_OF_MONTH));
      System.out.println("DATE: " + myDate.get(Calendar.DATE));
      System.out.println("DAY_OF_MONTH: " + myDate.get(Calendar.DAY_OF_MONTH));
      System.out.println("DAY_OF_YEAR: " + myDate.get(Calendar.DAY_OF_YEAR));
      System.out.println("DAY_OF_WEEK: " + myDate.get(Calendar.DAY_OF_WEEK));
      System.out.println("DAY_OF_WEEK_IN_MONTH: " + myDate.get(Calendar.DAY_OF_WEEK_IN_MONTH));
      System.out.println("AM_PM: " + myDate.get(Calendar.AM_PM));
      System.out.println("HOUR: " + myDate.get(Calendar.HOUR));
      System.out.println("HOUR_OF_DAY: " + myDate.get(Calendar.HOUR_OF_DAY));
      System.out.println("MINUTE: " + myDate.get(Calendar.MINUTE));
      System.out.println("SECOND: " + myDate.get(Calendar.SECOND));
      System.out.println("MILLISECOND: " + myDate.get(Calendar.MILLISECOND));
      
      System.out.println("am i leap year: " + isLeapYear(2007));
      
      /*
      int myYear = myDate.get(Calendar.YEAR);
      int myMonth = (myDate.get(Calendar.MONTH)  + 1);
      int myDate = myDate.get(Calendar.DATE);
      int myHour = myDate.get(Calendar.HOUR);
      
      String myTimestamp = myYear + "-" + myMonth + "-" + myDate + "T" + myDate.get(Calendar.HOUR) + ":" + myDate.get(Calendar.MINUTE) + ":" + myDate.get(Calendar.SECOND) + "." + myDate.get(Calendar.MILLISECOND) + "Z";
      

      System.out.println("TimeStamp: 2009-11-11T03:06:19.078Z");
      System.out.println("TimeStamp: " + myTimestamp);
      */
      
      //java.sql.Date currentTimestamp = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
      Timestamp ts = new Timestamp(System.currentTimeMillis());
      System.out.println("currentTimestamp: " + ts);
      
      Calendar cal2 = Calendar.getInstance(TimeZone.getTimeZone("GMT-2"));
      System.out.println("cal2.hour: " + cal2.get(Calendar.HOUR));
      System.out.println("cal2.month: " + cal2.get(Calendar.MONTH));
       System.out.println("cal2.date: " + cal2.get(Calendar.DATE));
       System.out.println("cal2.min: " + cal2.get(Calendar.MINUTE));
      
      
      

   }
   
   
}